/**
 * 
 */
package net.sf.graph4j.element.graph;


/**
 * @author palomino
 *
 */
public class VertexPair {

	private Vertex vertex1;
	
	private Vertex vertex2;
	
//	private static Map<Edge, VertexPair> edgeToPair = new HashMap<Edge, VertexPair>();
//	
//	private static Map<Edge, VertexPair> reverseEdgeToPair = new HashMap<Edge, VertexPair>();

	/**
	 * @param vertex1
	 * @param vertex2
	 */
	public VertexPair(Vertex vertex1, Vertex vertex2) {
		super();
		// TODO Auto-generated constructor stub
		this.vertex1 = vertex1;
		this.vertex2 = vertex2;
	}

	/* (non-Javadoc)
	 * @see java.lang.Object#equals(java.lang.Object)
	 */
	@Override
	public boolean equals(Object obj) {
		// TODO Auto-generated method stub
		if (obj instanceof VertexPair) {
			VertexPair pair = (VertexPair) obj;
			return (this.vertex1 == pair.vertex1 && this.vertex2 == pair.vertex2);
		}
		
		return false;
	}

	/* (non-Javadoc)
	 * @see java.lang.Object#hashCode()
	 */
	@Override
	public int hashCode() {
		// TODO Auto-generated method stub
		return vertex1.hashCode() * 2 + vertex2.hashCode();
	}
	
//	public static VertexPair makeFromEdge (Edge edge) {
//		
//		VertexPair pair = edgeToPair.get(edge);
//		if (pair == null) {
//			pair = new VertexPair(edge.source, edge.target);
//			edgeToPair.put(edge, pair);
//		}
//		return pair;
//	}
//	
//	public static VertexPair makeFromReverseEdge (Edge edge) {
//		
//		VertexPair pair = reverseEdgeToPair.get(edge);
//		if (pair == null) {
//			pair = new VertexPair(edge.source, edge.target);
//			reverseEdgeToPair.put(edge, pair);
//		}
//		return pair;
//	}
}
